package designPattern.action11.Visitor.Q1;//package DesigningPattenPIC.action.Visitor.Q3;
import java.util.Iterator;

import designPattern.action11.Visitor.Q1.concrete.visitor.ListVisitor;
import designPattern.action11.Visitor.Q1.concrete.entry.DirectoryEntry;
import designPattern.action11.Visitor.Q1.concrete.entry.ElementArrayList;
import designPattern.action11.Visitor.Q1.concrete.entry.FileEntry;
import designPattern.action11.Visitor.Q1.exception.FileTreatmentException;

public class MainQ3 {
    public static void main(String[] args) {
        try {
            DirectoryEntry root1 = new DirectoryEntry("root1");
            root1.add(new FileEntry("diary.html", 10));
            root1.add(new FileEntry("index.html", 20));

            DirectoryEntry root2 = new DirectoryEntry("root2");
            root2.add(new FileEntry("diary.html", 1000));
            root2.add(new FileEntry("index.html", 2000));

            ElementArrayList list = new ElementArrayList();
            list.add(root1);
            list.add(root2);
            list.add(new FileEntry("etc.html", 1234));

            list.accept(new ListVisitor());
        } catch (FileTreatmentException e) {
            e.printStackTrace();
        }
    }
}
